package com.qiudaozhang.jblog.article.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.qiudaozhang.jblog.article.mapper.ArticleTagMapper;
import com.qiudaozhang.jblog.article.service.ArticleTagService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author 邱道长
 * 时间： 2018/12/22 11:43
 */

@Service(version = "${service.version}",group = "${dubbo.group}")
public class ArticleTagServiceImpl implements ArticleTagService {

    @Autowired
    private ArticleTagMapper articleTagMapper;

    @Override
    public void deleteByTagId(Integer tagId) {
        articleTagMapper.deleteByTagId(tagId);
    }

    @Override
    public void save(int articleId, List<Integer> tagIds) {
        if(tagIds != null && tagIds.size() > 0)
        articleTagMapper.saveArticleIdAndTagIds(articleId,tagIds);
    }

    @Override
    public void deleteByArticleId(Integer articleId) {
        articleTagMapper.deleteByArticleId(articleId);
    }
}
